<?php
// +----------------------------------------------------------------------
// | Author: yaoyihong <510974211@qq.com>
// +----------------------------------------------------------------------

namespace app\api\model;

class Slide extends ApiBase
{

    public function getPicAttr($value, $data)
    {
        if ($value && !preg_match('/^http(s)?:\\/\\/.+/', $value)) {
            return SITE_PATH . $value;
        } else {
            return $value;
        }
    }

    public function slidecat()
    {
        return $this->belongsTo('SlideCat', 'cid', 'id');
    }
}